package ch02.home;

import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;

import java.io.File;
import java.util.Iterator;

public class Home04 {
    public static void main(String[] args) {
        try {
            SAXReader reader=new SAXReader();
            Document read = reader.read(new File("src/ch02/school.xml"));
            Element rootElement = read.getRootElement();
            for (Iterator it = rootElement.elementIterator();it.hasNext();){
                Element element=(Element)it.next();
                Element score = element.element("score");
                System.out.println(score.getText());
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
